<HTML>
<HEAD>
</HEAD>
<BODY>
<?php require('./View/ShowTable.php'); ?>
<?php require('./Controller/GetValues.php'); ?>
<?php $showTable = new ShowTable(); ?>
<table>
<tr>
<?php echo $showTable -> makeHeader($result, array("id" => "www.test")); ?>
<th>
	Remove
</th>
</tr>

<?php while ($line= mysql_fetch_array($result, MYSQL_ASSOC)):?>
	<?php $i++;?>
	
	<tr>
	<input type="hidden" name="<?php echo $i;?>[id]" value="<?php echo $line['id'] ?>">
	
	<?php unset($line['id']); ?>
	<?php $j =0 ?>
	<?php foreach ($line as $k=> $v): ?>
	<?php $type = mysql_field_type($result, $j) ?>
	
	<td>
	
	
	<?php if(isBoolean($k)): ?> <!-- 1 to concatanate so the values don't get over written -->
		<input type="hidden" name="<?php echo $i;?>[<?php echo $k;?>]" value="0">
		<input type="checkbox" name="<?php echo $i;?>[<?php echo $k;?>]" value="1"  <?php echo $text = (isChecked($v)) ? "checked=\"checked\"" : "" ?>> Yes
	<?php else: ?>
		<input type="text" name="<?php echo $i;?>[<?php echo $k;?>]" value="<?php echo $v; ?>">
	<?php endif; ?>
	</td>	
	<?php $oldLine = $line; ?>
	<?php $j++ ?>
	<?php endforeach; ?>
	<td align="center" valign="center">
		<input type="checkbox" name="<?php echo $i;?>[remove]" value="true">
	</td>
	</tr>
<?php endwhile; ?>
<tr>
<?php foreach ($oldLine as $k => $v): ?>
<td>
<?php if(isBoolean($k)): ?>
	<input type="hidden" name="<?php echo $i;?>[<?php echo $k;?>]" value="0">
	<input type="checkbox" name="<?php echo $i;?>[<?php echo $k;?>]" value="1"  <?php echo $text = (isChecked($v)) ? "checked=\"checked\"" : "" ?>> Yes
<?php else: ?>
	<input type="text" name="0[<?php echo $k;?>]">
<?php endif; ?>
</td>
<?php endforeach; ?>

</tr>
<tr>
	<td>
		<input type="submit" name="update" value="Update Table">
	</tr>
</td>
</form>
</table>
</BODY>